import url from '@/tool/index.js'
//会员中心
export const index = () => { //
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/user.user/index',
			data: {
				token:uni.getStorageSync('userToken')
			},
			method: 'get',
			success: (res) => resolve(res.data),
		});
	})
}
//更新用户信息
export const update = () => { //
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/user.user/profile',
			data: {
				token:uni.getStorageSync('userToken')
			},
			method: 'get',
			success: (res) => resolve(res.data),
		});
	})
}
//我的教练
export const myTeacher = (page=1,cartype=1) => { //
	return new Promise(resolve => {
		uni.request({
			url: url+'/api/user.user/mycollect',
			data: {
				page:page,
				cartype:cartype,
				token:uni.getStorageSync('userToken')
			},
			method: 'get',
			success: (res) => resolve(res.data),
		});
	})
}
//删除教练
export const delTeacher = (collectids,cartype=1) => { //
	return new Promise(resolve => {
		uni.request({
			url: url + '/api/user.user/mycollectDel',
			data: {
				token: uni.getStorageSync('userToken'),
				collectids:collectids,
				cartype:cartype,
			},
			header:{
				'Content-Type':'application/x-www-form-urlencoded'
			},
			method: 'POST',
			success: (res) => resolve(res.data),
		});
	})
}

